package com.mylogistics.common.vo;

import lombok.Getter;
import lombok.Setter;

/**
 * 数据格式类型
 */
@Getter
@Setter
public class ResultData {
    public static final int SUCCESS=20000;//操作成功
    public static final int FAIL=40000;//操作失败
    public static final Integer INVALIDATE_TOKEN = 50008;//token无效
    public static final Integer TIME_OUT = 50009;//登录超时
    Integer code;//返回的操作码
    String msg;//存放返回的描述信息
    Object data;//存放返回的数据
    public static ResultData success(String msg,Object obj){
        ResultData resultData = new ResultData();
        resultData.setCode(SUCCESS);
        resultData.setMsg(msg);
        resultData.setData(obj);
        return resultData;
    }

    public static ResultData fail(String msg,Object obj){
        ResultData resultData = new ResultData();
        resultData.setCode(FAIL);
        resultData.setMsg(msg);
        resultData.setData(obj);
        return resultData;
    }
}
